
///data for Bittner, Amanda. 2018. "Leaders Always Mattered: The Persistence of Personality in Canadian Elections"
///in Electoral Studies. 

///merged dataset composed from Canadian Election Studies
///individual election studies data available for download at https://ces-eec.arts.ubc.ca/

///syntax for dataset recodes for each individual election study & merging/compilation syntax
///available from the author, send an email to abittner@mun.ca

///below is syntax for analysis commands only, organized by Figure number





///Figure 1: Perceptions of Leaders’ Personality Traits 


use canadamerged.dta, clear


collapse conscompdiff conschardiff c_lcompdiff c_lchardiff leftcompdiff leftchardiff, by(year)

twoway (line conscompdiff year, lcolor(gray) lpattern(dash) lwidth(medthick))/*
*/ (line c_lcompdiff year, lcolor(gray) lpattern(solid) lwidth(medthick))/*
*/ (line leftcompdiff year, lcolor(black) lpattern(dot) lwidth(thick)),/*
*/ ytitle(Competence Rating, orientation(vertical)) xtitle(Election Year) xlabel(1984 "1984" 1988 "1988" 1993 "1993" 1997 "1997" 2000 "2000" 2004 "2004" 2006 "2006" 2011 "2011" 2015 "2015")/*
*/ title(Ratings of Leaders' Competence Over Time, size(medsmall)) subtitle(compared to mean rating of all leaders, size(small)) /*
*/ legend(rows(1) order(1 "Conservative" 2 "Liberal" 3 "NDP") size(small)) graphregion(fcolor(white) lcolor(white)/*
*/ ifcolor(white) ilcolor(white)) plotregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))

twoway (line conschardiff year, lcolor(gray) lpattern(dash) lwidth(medthick))/*
*/ (line c_lchardiff year, lcolor(gray) lpattern(solid) lwidth(medthick))/*
*/ (line leftchardiff year, lcolor(black) lpattern(dot) lwidth(thick)),/*
*/ ytitle(Character Rating, orientation(vertical)) xtitle(Election Year) xlabel(1984 "1984" 1988 "1988" 1993 "1993" 1997 "1997" 2000 "2000" 2004 "2004" 2006 "2006" 2011 "2011" 2015 "2015")/*
*/ title(Ratings of Leaders' Character Over Time, size(medsmall)) subtitle(compared to mean rating of all leaders, size(small)) /*
*/ legend(rows(1) order(1 "Conservative" 2 "Liberal" 3 "NDP") size(small)) graphregion(fcolor(white) lcolor(white)/*
*/ ifcolor(white) ilcolor(white)) plotregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))



///Figure 2: Partisanship and Ideology, 1984-2015 

use canadamerged.dta, clear
collapse c_lid leftid consid noid, by(year)

twoway (line leftid year, lcolor(black) lpattern(dot) lwidth(thick))/*
*/ (line c_lid year, lcolor(gray) lpattern(solid) lwidth(medthick))/*
*/ (line consid year, lcolor(gray) lpattern(dash) lwidth(medthick))/*
*/ (line noid year, lcolor(red) lpattern(solid) lwidth(thick)),/*
*/ ytitle(Partisanship, orientation(vertical) size(small)) xtitle(Election Year) xlabel(1984 "1984" 1988 "1988" 1993 "1993" 1997 "1997" 2000 "2000" 2004 "2004" 2006 "2006" 2008 "2008" 2011 "2011" 2015 "2015")/*
*/ title(Partisanship Over Time, size(medsmall)) /*
*/ legend(order(1 "NDP PID" 2 "Liberal PID" 3 "Conservative PID" 4 "No PID") rows(1) size(small)) graphregion(fcolor(white) lcolor(white)/*
*/ ifcolor(white) ilcolor(white)) plotregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))


use canadamerged.dta, clear
collapse ideology, by(year leftid consid c_lid)

twoway (line ideology year if leftid==1, lcolor(black) lpattern(dot) lwidth(thick))/*
*/ (line ideology year if c_lid==1, lcolor(gray) lpattern(solid) lwidth(medthick))/*
*/ (line ideology year if consid==1, lcolor(gray) lpattern(dash) lwidth(medthick)),/*
*/ ytitle(Ideology, orientation(vertical) size(small)) xtitle(Election Year) xlabel(1984 "1984" 1988 "1988" 1993 "1993" 1997 "1997" 2000 "2000" 2004 "2004" 2006 "2006" 2008 "2008" 2011 "2011" 2015 "2015")/*
*/ title(Left-Right Self-Placement Over Time, size(medsmall)) /*
*/ legend(order(1 "NDP partisans" 2 "Liberal Partisans" 3 "Conservative Partisans") rows(1) size(small)) graphregion(fcolor(white) lcolor(white)/*
*/ ifcolor(white) ilcolor(white)) plotregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))




///Figure 3: Tracking the Impact of Perceptions of Traits on Conservative Party Vote Choice 

use canadamerged.dta, clear


logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1984 & pq==0
est store consvote1984
margins, dydx(conscompetence conscharacter) saving(consvote1984, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1988 & pq==0
est store consvote1988
margins, dydx(conscompetence conscharacter) saving(consvote1988, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1993 & pq==0
est store consvote1993
margins, dydx(conscompetence conscharacter) saving(consvote1993, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1997 & pq==0
est store consvote1997
margins, dydx(conscompetence conscharacter) saving(consvote1997, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2000 & pq==0
est store consvote2000
margins, dydx(conscompetence conscharacter) saving(consvote2000, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2004 & pq==0
est store consvote2004
margins, dydx(conscompetence conscharacter) saving(consvote2004, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2006 & pq==0
est store consvote2006
margins, dydx(conscompetence conscharacter) saving(consvote2006, replace)

logit consvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2015 & pq==0
est store consvote2015
margins, dydx(conscompetence conscharacter) saving(consvote2015, replace)


combomarginsplot consvote1984 consvote1988 consvote1993 consvote1997 consvote2000 consvote2004 consvote2006 consvote2015, ///
recast(connected) noci  ///
label("1984" "1988" "1993" "1997" "2000" "2004" "2006" "2015") name(Consvote, replace)



///Figure 4: Tracking the Impact of Perceptions of Traits on Liberal Party Vote Choice

use canadamerged.dta, clear


logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1984 & pq==0
est store c_lvote1984
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote1984, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1988 & pq==0
est store c_lvote1988
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote1988, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1993 & pq==0
est store c_lvote1993
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote1993, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1997 & pq==0
est store c_lvote1997
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote1997, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2000 & pq==0
est store c_lvote2000
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote2000, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2004 & pq==0
est store c_lvote2004
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote2004, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2006 & pq==0
est store c_lvote2006
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote2006, replace)

logit c_lvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2015 & pq==0
est store c_lvote2015
margins, dydx(c_lcompetence c_lcharacter) saving(c_lvote2015, replace)


combomarginsplot c_lvote1984 c_lvote1988 c_lvote1993 c_lvote1997 c_lvote2000 c_lvote2004 c_lvote2006 c_lvote2015, ///
recast(connected) noci  ///
label("1984" "1988" "1993" "1997" "2000" "2004" "2006" "2015") name(c_lvote, replace)



///Figure 5: Tracking the Impact of Perceptions of Traits on NDP Vote Choice

use canadamerged.dta, clear

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1984 & pq==0
est store leftvote1984
margins, dydx(leftcompetence leftcharacter) saving(leftvote1984, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid/*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1988 & pq==0
est store leftvote1988
margins, dydx(leftcompetence leftcharacter) saving(leftvote1988, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1993 & pq==0
est store leftvote1993
margins, dydx(leftcompetence leftcharacter) saving(leftvote1993, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==1997 & pq==0
est store leftvote1997
margins, dydx(leftcompetence leftcharacter) saving(leftvote1997, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2000 & pq==0
est store leftvote2000
margins, dydx(leftcompetence leftcharacter) saving(leftvote2000, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2004 & pq==0
est store leftvote2004
margins, dydx(leftcompetence leftcharacter) saving(leftvote2004, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2006 & pq==0
est store leftvote2006
margins, dydx(leftcompetence leftcharacter) saving(leftvote2006, replace)

logit leftvote i.married i.woman i.university i.fulltimework i.agecategory c.income/*
*/ i.consid i.c_lid i.leftid /*
*/ c.conscompetence conscharacter c_lcompetence c_lcharacter leftcompetence leftcharacter if year==2015 & pq==0
est store leftvote2015
margins, dydx(leftcompetence leftcharacter) saving(leftvote2015, replace)


combomarginsplot leftvote1984 leftvote1988 leftvote1993 leftvote1997 leftvote2000 leftvote2004 leftvote2006 leftvote2015, ///
recast(connected) noci  ///
label("1984" "1988" "1993" "1997" "2000" "2004" "2006" "2015") name(leftvote, replace)




